fix: Add China regions to elb_service_accounts #264
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes ELB log delivery in AWS China regions
Motivation and Context
In release 3.8.2, a fix was made to support newer AWS regions which use a different log delivery policy:
3c094b3
The method of the fix is essentially "if the old region exists in this list, use the old way, otherwise use the new way". Unfortunately, the China regions were left out of this list, so this module treats them as though they're new regions, and sets the Principal to
Service": "logdelivery.elasticloadbalancing.amazonaws.com
, when it should be the old format:"AWS": "arn:aws-cn:iam::638102146993:root"
(example given is for cn-north-1)Documentation here describes regions excluding China: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/enable-access-logging.html#attach-bucket-policy
China regions are included here: https://docs.amazonaws.cn/en_us/elasticloadbalancing/latest/application/enable-access-logging.html#attach-bucket-policy
Breaking Changes
No, simply adds China regions to existing list
How Has This Been Tested?
I have updated at least one of the
examples/*
to demonstrate and validate my change(s)Added examples/china-log-bucket-failure, which is similar to the complete example with some stuff removed for clarity.
I have tested and validated these changes using one or more of the provided
examples/*
projectsThis is a very simple change. I tried to create an S3 bucket with ELB log permissions and get this error:
failure configuring LB attributes: InvalidConfigurationRequest: Access Denied for bucket: test-bucket-cn-elb-logs-cn-north-1. Please check S3bucket permission
I then changed the module source to my branch in github:
and the bucket is deployed as expected
pre-commit run -a
on my pull request